/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package plum.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import plum.MinMaxDecision;
import plum.PlumPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Min Max Decision</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link plum.impl.MinMaxDecisionImpl#getMinBoundary <em>Min Boundary</em>}</li>
 *   <li>{@link plum.impl.MinMaxDecisionImpl#getMaxBoundary <em>Max Boundary</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MinMaxDecisionImpl extends SimpleDecisionImpl implements MinMaxDecision {
	/**
	 * The default value of the '{@link #getMinBoundary() <em>Min Boundary</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinBoundary()
	 * @generated
	 * @ordered
	 */
	protected static final int MIN_BOUNDARY_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getMinBoundary() <em>Min Boundary</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinBoundary()
	 * @generated
	 * @ordered
	 */
	protected int minBoundary = MIN_BOUNDARY_EDEFAULT;

	/**
	 * The default value of the '{@link #getMaxBoundary() <em>Max Boundary</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxBoundary()
	 * @generated
	 * @ordered
	 */
	protected static final int MAX_BOUNDARY_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getMaxBoundary() <em>Max Boundary</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxBoundary()
	 * @generated
	 * @ordered
	 */
	protected int maxBoundary = MAX_BOUNDARY_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MinMaxDecisionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return PlumPackage.Literals.MIN_MAX_DECISION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getMinBoundary() {
		return minBoundary;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMinBoundary(int newMinBoundary) {
		int oldMinBoundary = minBoundary;
		minBoundary = newMinBoundary;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, PlumPackage.MIN_MAX_DECISION__MIN_BOUNDARY, oldMinBoundary, minBoundary));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getMaxBoundary() {
		return maxBoundary;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxBoundary(int newMaxBoundary) {
		int oldMaxBoundary = maxBoundary;
		maxBoundary = newMaxBoundary;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, PlumPackage.MIN_MAX_DECISION__MAX_BOUNDARY, oldMaxBoundary, maxBoundary));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case PlumPackage.MIN_MAX_DECISION__MIN_BOUNDARY:
				return getMinBoundary();
			case PlumPackage.MIN_MAX_DECISION__MAX_BOUNDARY:
				return getMaxBoundary();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case PlumPackage.MIN_MAX_DECISION__MIN_BOUNDARY:
				setMinBoundary((Integer)newValue);
				return;
			case PlumPackage.MIN_MAX_DECISION__MAX_BOUNDARY:
				setMaxBoundary((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case PlumPackage.MIN_MAX_DECISION__MIN_BOUNDARY:
				setMinBoundary(MIN_BOUNDARY_EDEFAULT);
				return;
			case PlumPackage.MIN_MAX_DECISION__MAX_BOUNDARY:
				setMaxBoundary(MAX_BOUNDARY_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case PlumPackage.MIN_MAX_DECISION__MIN_BOUNDARY:
				return minBoundary != MIN_BOUNDARY_EDEFAULT;
			case PlumPackage.MIN_MAX_DECISION__MAX_BOUNDARY:
				return maxBoundary != MAX_BOUNDARY_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (minBoundary: ");
		result.append(minBoundary);
		result.append(", maxBoundary: ");
		result.append(maxBoundary);
		result.append(')');
		return result.toString();
	}

} //MinMaxDecisionImpl
